package com.xuyoupeng.springframework.beans.factory.support;

import com.xuyoupeng.springframework.beans.BeansException;
import com.xuyoupeng.springframework.beans.core.io.DefaultResourceLoader;
import com.xuyoupeng.springframework.beans.core.io.Resource;
import com.xuyoupeng.springframework.beans.core.io.ResourceLoader;
import org.springframework.util.Assert;

/**
 * @author xuyoupneg
 * @description bean定义读取器的抽象类
 * @date 2024/3/19 19:39
 */
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {

    private final BeanDefinitionRegistry registry;

    private ResourceLoader resourceLoader;

    protected AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
        this(registry, new DefaultResourceLoader());
    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry, ResourceLoader resourceLoader) {
        this.registry = registry;
        this.resourceLoader = resourceLoader;
    }

    @Override
    public BeanDefinitionRegistry getRegister() {
        return registry;
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return this.resourceLoader;
    }

}
